
/*
The statement "implements Comparable<Card>" tells Java that we are going to provide a "compareTo" method to determine how Card objects should be compared. If Java knows how to compare Card objects, it can then sort Card objects in an ArrayList automatically for us, which we will take advantage of in the HandEvaluator class.
*/
public class Card {

//Instance Fields
private int value;
private char suit;
private String desc;

/*
Constructs a card with the given value and suit. Card values are 2-14 where 11 is a Jack, 12 is a Queen, 13 is a King, 14 is an Ace, and all other values represent themselves (e.g. 2 is a 2). Card suits are 'H' for Hearts, 'D' for Diamonds, 'S' for Spades, and 'C' for Clubs. The constructor should initialize all instance fields appropriately. The desc instance field represents a card in the manner of: "AD", 10C", "JH", etc. In this project, Cards are created in the Deck class.
*/
public Card(int inValue, char inSuit)
{
	
	value=inValue;
	suit=inSuit;
	
	if(value>10)
	{
		String temp="";
		if (value==11)
			temp="J";
		if (value==12)
			temp="Q";
		if (value==13)
			temp="K";
		if (value==14)
			temp="A";
		desc=temp+suit;
	}
	else
		desc=value+""+suit;
	
}
//Returns the value of the card
public int getValue()
{
	return value;
}

//Returns the suit of the card
public char getSuit()
{
	return suit;
}

/*
This method should return negative one (-1) if the current card is less than the card passed in (by value, then suit), positive one (1) if the current card is greater than the card passed in (by value, then suit), or zero (0) if the cards are equal (by value AND suit). This method is used by Java to sort Card objects, which we take advantage of in the HandEvaluator class.
*/
public boolean ValueHigherThan(Card c)
{

	if (value > c.getValue() || (value == c.getValue() && suit > c.getSuit()))
		return true;
	else
		return false;
}

/*
This method returns true if the the current card's value is equal to the card passed in, or false otherwise. This method allows us to compare cards based on their values only, which is helpful in the HandEvalutor class when we need to determine how many cards in a hand match a certain value. For instance, how many 2's do we have (2 of a kind, 3 of a kind, etc).
*/
public boolean equalsValue(Card c)
{
	if(c.getValue()==value)
		return true;
	else
	return false;
}

public boolean equalsSuit(Card c)
{
	if(c.getSuit()==suit)
		return true;
		
		return false;
	
}

//Returns the description of the card
public String toString()
{
	return desc;
}
}